package com.isfto.controller;


import com.isfto.code.ResponseData;
import com.isfto.entity.R;
import com.isfto.entity.tablepojo.FlightChange;
import com.isfto.entity.tablepojo.PageBean;
import com.isfto.entity.tablepojo.UpdateFilghtStatus;
import com.isfto.service.BeforeFlightChangeEnterAndOutService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/inform")
public class BeforeFlightChangeEnterAndOutController extends BaseController{
    @Resource
    BeforeFlightChangeEnterAndOutService beforeFlightChangeEnterService;
    @PostMapping
    public ResponseData<Boolean> beforeSaveInfo(@RequestBody FlightChange flightChange) {
       int total= beforeFlightChangeEnterService.beforeSaveInfo(flightChange);
        return returnBoolean( true );
    }
    @PostMapping("/out")
    public ResponseData<Boolean> beforeSaveInfoOut(@RequestBody FlightChange flightChange) {
        int total= beforeFlightChangeEnterService.beforeSaveInfoOut(flightChange);
        return returnBoolean( true );
    }

    @GetMapping("/audit")
    public ResponseData<Object> auditor(Integer page, Integer pageSize, Integer status) {
        PageBean pageBean = beforeFlightChangeEnterService.audittickets(page,pageSize,status);
        return returnObject( pageBean );
    }
    @PostMapping("updateStatus")
    public ResponseData<Boolean > updatestatus(@RequestBody UpdateFilghtStatus updateFilghtStatus){

        Boolean b = beforeFlightChangeEnterService.update( updateFilghtStatus );
        return returnBoolean( b );

    }

    @GetMapping("/beforeout")
    public R beforeInfoOut(String cfno,String startapcd,String endapcd) {
        PageBean pageBean = beforeFlightChangeEnterService.beforeInfoOut(cfno, startapcd, endapcd);
        return R.success(pageBean);
    }
    @DeleteMapping("/delinfo")
    public R deleteInfo(@RequestBody FlightChange flightChange) {
        int i = beforeFlightChangeEnterService.deleteInfo(flightChange.getCfno(),flightChange.getStartapcd(),flightChange.getEndapcd());
        return R.success(null);
    }
    @DeleteMapping("/delinfoout")
    public R deleteInfoOut(@RequestBody FlightChange flightChange) {
        int i = beforeFlightChangeEnterService.deleteInfoOut(flightChange.getCfno(),flightChange.getStartapcd(),flightChange.getEndapcd());
        return R.success(null);
    }

}
